<template>
	<view class="content">
		注册界面
		<table>
			<tr>
				<td>用户名</td>
				<td><input type="text" v-model="username" style="background-color: antiquewhite;"></td>
			</tr>

			<tr>
				<td>密码</td>
				<td><input type="text" v-model="password" style="background-color: antiquewhite;"></td>
			</tr>
			<tr>
				<td>图片</td>
				<td><button @click="getimg()">上传图片</button></td>
			</tr>
		</table>
		<view style="display: flex;">
			<button @click="resis()">注册</button>
		</view>


	</view>
</template>

<script>
	export default {
		data() {
			return {
				username: "",
				password: "",
				fileimg : "",
			}
		},
		methods: {
			resis() {
				uni.uploadFile({
					url: 'http://127.0.0.1:8080/resister', //仅为示例，非真实的接口地址
					filePath: this.fileimg,
					name: 'img',
					formData: {
						username: this.username,
						password: this.password,
					},
					success: (uploadFileRes) => {
						console.log(uploadFileRes);
					}
				});
			},
			getimg() {
				uni.chooseImage({
					success: (chooseImageRes) => {
						const tempFilePaths = chooseImageRes.tempFilePaths;
						this.fileimg = tempFilePaths[0]
					}
				});
			},


		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>